﻿<!--
 Peter
 Created by: Peter Development Team
    http://peter.codeplex.com/
 
 GNU General Public License version 2 (GPLv2)
    http://peter.codeplex.com/license
-->
<UserControl x:Class="Peter.View.ViewOptionsEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:data="clr-namespace:Peter.Data"
             xmlns:controls="clr-namespace:Peter.Common.Controls;assembly=Peter.Common"
             mc:Ignorable="d"
             d:DesignHeight="700"
             d:DesignWidth="500"
             d:DataContext="{d:DesignInstance data:OptionsEditor}">
   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>

      <GroupBox Header="Font"
                Grid.Row="0"
                Margin="5,0">
         <Grid Margin="10">
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="200px" />
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <TextBlock Text="Font:"
                       Grid.Row="0"
                       Grid.Column="0"
                       HorizontalAlignment="Right"
                       VerticalAlignment="Center"
                       Margin="0,0,5,0" />

            <ComboBox xmlns:ComponentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
                      ItemTemplate="{DynamicResource FontTemplate}"
                      SelectedItem="{Binding Path=SelectedFont}"
                      Grid.Row="0"
                      Grid.Column="1"
                      Width="200">
               <ComboBox.Resources>

                  <CollectionViewSource x:Key="myFonts"
                                        Source="{Binding Source={x:Static Fonts.SystemFontFamilies}}">
                     <CollectionViewSource.SortDescriptions>
                        <ComponentModel:SortDescription PropertyName="Source" />
                     </CollectionViewSource.SortDescriptions>
                  </CollectionViewSource>

                  <Style x:Key="FontStyle">
                     <Setter Property="Control.FontFamily"
                             Value="{Binding Source}" />
                     <Setter Property="Control.FontSize"
                             Value="16" />
                  </Style>

                  <DataTemplate x:Key="FontTemplate">
                     <StackPanel VirtualizingStackPanel.IsVirtualizing="True">
                        <TextBlock Style="{StaticResource FontStyle}"
                                   Text="{Binding Source}"
                                   ToolTip="{Binding Source}" />
                     </StackPanel>
                  </DataTemplate>

               </ComboBox.Resources>

               <ComboBox.ItemsSource>
                  <Binding Source="{StaticResource myFonts}" />
               </ComboBox.ItemsSource>
            </ComboBox>

            <TextBlock Text="Size:"
                       Grid.Row="1"
                       Grid.Column="0"
                       HorizontalAlignment="Right"
                       VerticalAlignment="Center"
                       Margin="0,0,5,0" />

            <ComboBox Grid.Row="1"
                      Grid.Column="1"
                      Width="200"
                      SelectedItem="{Binding Path=FontSize}">
               <ComboBox.Resources>
                  <DoubleCollection x:Key="sizeCollection">
                     8,10,12,14,16,18,20,22,24,26,28,30,32,40,48,72
                  </DoubleCollection>
               </ComboBox.Resources>

               <ComboBox.ItemsSource>
                  <Binding Source="{StaticResource sizeCollection}" />
               </ComboBox.ItemsSource>

            </ComboBox>

         </Grid>
      </GroupBox>

      <GroupBox Header="Lines"
                Grid.Row="1"
                Margin="5,0">
         <Grid Margin="10">
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <CheckBox Grid.Row="0"
                      Content="Show Line Numbers"
                      IsChecked="{Binding Path=ShowLineNumbers}" />

            <CheckBox Grid.Row="1"
                      Content="Wrap Long Text"
                      IsChecked="{Binding Path=WrapText}" />

            <CheckBox Grid.Row="2"
                      Content="Highlight Current Line"
                      IsChecked="{Binding Path=HighlightCurrentLine}" />

            <CheckBox Grid.Row="3"
                      Content="Show Vertical Ruler"
                      IsChecked="{Binding Path=ShowVerticalRuler}" />

            <controls:NumericUpDown Grid.Row="4"
                                    Value="{Binding Path=VerticalRulerColumn}"
                                    IsEnabled="{Binding Path=ShowVerticalRuler}"
                                    Label="column"
                                    HorizontalAlignment="Left"
                                    Precision="0" />
         </Grid>
      </GroupBox>

      <GroupBox Header="Glyphs"
                Grid.Row="2"
                Margin="5,0">
         <Grid Margin="10">
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <CheckBox Grid.Row="0"
                      Content="Show Tabs"
                      IsChecked="{Binding Path=ShowTabs}" />

            <CheckBox Grid.Row="1"
                      Content="Show Spaces"
                      IsChecked="{Binding Path=ShowSpaces}" />

            <CheckBox Grid.Row="2"
                      Content="Show End of Line"
                      IsChecked="{Binding Path=ShowEol}" />

            <CheckBox Grid.Row="3"
                      Content="Code Folding"
                      IsChecked="{Binding Path=CodeFolding}" />

         </Grid>
      </GroupBox>

      <GroupBox Header="Tabs"
                Grid.Row="3"
                Margin="5,0">
         <Grid Margin="10">
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <CheckBox Grid.Row="0"
                      Content="Convert Tabs to Spaces"
                      IsChecked="{Binding Path=ConvertTabsToSpaces}" />

            <StackPanel Orientation="Horizontal"
                        Grid.Row="1"
                        Margin="0,5,0,0">
               <controls:NumericUpDown Value="{Binding Path=IndentSize}"
                                       Precision="0"
                                       Label="Indention Spaces" />
            </StackPanel>
         </Grid>
      </GroupBox>

      <GroupBox Header="Links"
                Grid.Row="4"
                Margin="5,0">
         <Grid Margin="10">
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <CheckBox Grid.Row="0"
                      Content="Allow Email Links to be Clickable"
                      IsChecked="{Binding Path=EnableEmails}" />

            <CheckBox Grid.Row="1"
                      Content="Allow Hyper Links to be Clickable"
                      IsChecked="{Binding Path=EnableHyperlinks}" />

            <CheckBox Grid.Row="2"
                      Content="Require Ctrl to be Press to Click Links"
                      IsChecked="{Binding Path=HoldCtrlForHyperlinks}" />
         </Grid>
      </GroupBox>

      <GroupBox Header="Misc"
                Grid.Row="5"
                Margin="5,0">
         <Grid Margin="10">
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <CheckBox Grid.Row="0"
                      Content="Allow Scrolling Past Document End"
                      IsChecked="{Binding Path=AllowScrollPastDocument}" />
         </Grid>
      </GroupBox>

      <GroupBox Grid.Row="6"
                Margin="5,0"
                Header="Highlighting Extensions">
         <Grid>
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
         </Grid>
      </GroupBox>
   </Grid>
   
</UserControl>